package com.xymtop.api.implement;

import com.xymtop.api.entity.MyFile;
import com.xymtop.api.mapper.MyFileMapper;
import com.xymtop.api.service.MyFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * @ClassName : MyFileImpl
 * @Description : 文件相关接口实现
 * @Author : 肖叶茂
 * @Date: 2022/12/1  10:48
 */




@Service
public class MyFileImpl implements MyFileService {

    @Autowired
    private MyFileMapper myFileMapper;


    @Override
    public Boolean upLoadFile(MyFile file) {
       if(myFileMapper.addFile(file.getId(),file.getType(),file.getContentid(),file.getContenttype(),file.getUrl(),file.getStatus())==0){
           return false;
       }
        return true;
    }

    @Override
    public Boolean deleteFile(String id) {
        if(myFileMapper.deleteFile(id)==0){
            return  false;
        }
        return true;
    }

    @Override
    public MyFile getFileById(String id) {
        MyFile file = myFileMapper.getFileById(id);

       return  file;
    }
}
